import { isvalidUUID } from '@/utils/validate'

const validateUUID = (rule: string, value: string, callback: (err?: Error) => void) => {
  if (!value) {
    callback(new Error('请输入UUID'));
  } else if (isvalidUUID(value)) {
    callback();
  } else {
    callback(new Error('UUID格式不正确'));
  }
};

export const rule = [
  { required: true, message: '请输入UUID', trigger: 'blur' },
  { validator: validateUUID, trigger: 'blur' }
]
